<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{$Think.config.site.title} - 客户信息编辑</title>
    <meta name="keywords" content="{$Think.config.site.keywords}">
    <meta name="description" content="{$Think.config.site.description}">
    <link rel="shortcut icon" href="favicon.ico"> <link href="{$Think.config.site.resource_url}css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/animate.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/style.css?v=4.1.0" rel="stylesheet">
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">

    <div class="row">
        <div class="col-sm-7">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>{:lang('更新客户信息')}</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                    </div>

                </div>
                <div class="ibox-content">
                    <form method="post" class="form-horizontal" action="" id="updateUser" >
                        <input type="hidden" name="id" value="{$v['id'] ?? ''}" />
                        <div class="form-group">
                            <label class="col-sm-2 control-label">{:lang('用户名')}</label>
                            <div class="col-sm-10">
                                <input id="name" name="name" class="form-control" type="text" value="{$v['name'] ?? ''}">

                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label" >{:lang('电话')}</label>
                            <div class="col-sm-10">
                                <input id="mobile" name="mobile" class="form-control" type="text" value="{$v['mobile'] ?? ''}">

                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label" >{:lang('性别')}</label>
                            <div class="col-sm-10">
                                <!-- <input  name="gender" class="form-control" type="text" value="{$v['gender'] ?? ''}"> -->
                                <div class="radio radio-info radio-inline">
                                    <input type="radio" id="inlineRadio1" value="1" name="gender" {if condition="$v.gender eq '1'"} checked="checked"{/if} >
                                    <label for="inlineRadio1"> {:lang('男')} </label>
                                </div>
                                <div class="radio radio-info radio-inline">
                                    <input type="radio" id="inlineRadio2" value="2" name="gender" {if condition="$v.gender eq '2'"} checked="checked"{/if} >
                                    <label for="inlineRadio2"> {:lang('女')} </label>
                                </div>
                                <div class="radio radio-info radio-inline">
                                    <input type="radio" id="inlineRadio3" value="0" name="gender" {if condition="$v.gender eq '0'"} checked="checked"{/if} >
                                    <label for="inlineRadio3"> {:lang('保密')} </label>
                                </div>

                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">{:lang('省份')}</label>
                            <div class="col-sm-10">
                                <input id="province" name="province" class="form-control" type="text" value="{$v['province'] ?? ''}">

                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">{:lang('城市')}</label>
                            <div class="col-sm-10">
                                <input id="city" name="city" class="form-control" type="text" value="{$v['city'] ?? ''}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">{:lang('押金')}</label>
                            <div class="col-sm-10">
                                <input id="deposit" name="deposit" class="form-control" type="text" value="{$v['deposit'] ?? ''}" readOnly="true" disabled="true">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">{:lang('余额')}</label>
                            <div class="col-sm-10">
                                <input id=" balance" name="balance" class="form-control" type="text" value="{$v['balance'] ?? ''}" readOnly="true" disabled="true">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">

                                <input type="button" class="btn btn-primary" value="{:lang('提交')}" id="update">

                            </div>
                        </div>
                    </form>
                    <div class="hr-line-dashed"></div>
                </div>
            </div>
        </div>
        <div class="col-sm-5">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>{:lang('更多信息')}</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                    </div>
                </div>

                <div class="ibox-content">
                    <p><img id="avatar" width=200 height=200 alt="image"  src="{$v['picture']}" /></p>
                </div>

                <div class="ibox-content" style="margin-top: 15px;">

                    <h5>{:lang('最近租借记录')}</h5>
                    <hr>

                    <table class="table table-hover">
                        <thead>
                        <tr>
                            <th>{:lang('订单名称')}</th>
                            <th>{:lang('共享柜ID')}</th>
                            <th>{:lang('金额')}</th>
                            <th>{:lang('时间')}</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php
                                  if(empty($list)){
                                    echo "<tr><td colspan='5' style='text-align: center;color: #ff0000;'>".lang('暂无租借记录')."</td></tr>";
                        }
                        ?>
                        {volist name="list" id="v"}
                        <tr>
                            <td>{$v.name}</td>
                            <td>{$v.cabinetid}</td>
                            <td>{$v.amount}</td>
                            <td>{$v.create_time|date= "Y-m-d H:i:s",###}</td>
                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>

    </div>
</div>

<script src="{$Think.config.site.resource_url}js/jquery.min.js?v=2.1.4"></script>
<script src="{$Think.config.site.resource_url}js/bootstrap.min.js?v=3.3.5"></script>
<script src="{$Think.config.site.resource_url}js/content.min.js?v=1.0.0"></script>
<script src="{$Think.config.site.resource_url}js/plugins/validate/jquery.validate.min.js"></script>
<script src="{$Think.config.site.resource_url}js/plugins/validate/messages_zh.min.js"></script>
<script src="{$Think.config.site.resource_url}js/plugins/layer/layer.js"></script>
<script src="{$Think.config.site.resource_url}js/plugins/sweetalert/sweetalert.min.js"></script>
<script type="text/javascript">
    $('#Refund').click(function () {
        swal({
                title: "您确定要退押金",
                text: "退押金后无法恢复，请谨慎操作！",
                type: "warning",
                showCancelButton: true,
                confirmButtonColor: "#DD6B55",
                confirmButtonText: "是的，我要退押金！",
                cancelButtonText: "让我再考虑一下…",
                closeOnConfirm: false,
                closeOnCancel: false
            },
            function (isConfirm) {
                if (isConfirm) {
                    var action = 'depositRefund';
                    var deposit = $("#yjje").val();
                    var id = $('#yjtkid').val();
                    $.ajax({
                        type: "post",
                        url : '<?php echo \think\Request::instance()->root(); ?>/<?php echo \think\Request::instance()->module(); ?>/Customer/'+action,
                        dataType : 'json',
                        data : {id:id,deposit:deposit},
                        success: function(result){
                            if(0 === result.code) {
                                //layer.msg(result.msg, {icon: 1});
                                swal("押金退款已成功！", "您已经退了一笔押金,请注意查收。", "success");
                            }else{
                                //layer.msg(result.msg, {icon: 5});
                                swal("已失败", "押金退款失败！", "error");
                            }

                        },
                        error : function(){
                            // layer.msg('服务器错误！请稍后重试', {icon: 2});
                            swal("服务器错误", "请稍后重试...", "error");
                        }

                    });

                } else {
                    swal("已取消", "您取消了退押金操作！", "error");
                }
            });
    });
</script>
<script type="text/javascript">
    $(function(){
        //更新信息
        $("#update").click(function(){
            var fomrData = $("#updateUser").serialize();
            var action = 'edit';
            $.ajax({
                type: "post",
                url : '<?php echo \think\Request::instance()->root(); ?>/<?php echo \think\Request::instance()->module(); ?>/Customer/'+action,
                dataType : 'json',
                data : fomrData,
                success: function(result){
                    if(0 === result.code) {
                        layer.msg(result.msg, {icon: 1});
                        parent.location.reload();
                    }else{
                        layer.msg(result.msg, {icon: 5});
                    }
                },
                error : function(){
                    layer.msg("{:lang('服务器错误！请稍后重试')}", {icon: 2});
                }

            });
        });

        //点击退款押金

    });
</script>

</body>

</html>
